﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 字符串对比
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1,s2;
            s2 = Console.ReadLine();
            s1 = Console.ReadLine();
            int x=s1.Length,c=s2.Length;
            if (s1.Length > s2.Length)
            {
                int z = x;
                x = c;
                c = z;
            }
            int lon = 0;
            for(int i = 0; i < x; i++)
            {
                if (s1[i] == s2[i]) lon++;
            }
            double t = Convert.ToDouble(lon)/Convert.ToDouble(c);
            Console.WriteLine(t);
        }
    }
}
